

_xinstore_db_ie = function(){};
_xinstore_db_ie.prototype.type = "ie";
_xinstore_db_ie.prototype.store = null;
_xinstore_db_ie.prototype.name = "";
_xinstore_db_ie.prototype.xid = "xinstore_db_ie_storage_object";

_xinstore_db_ie.prototype.test = function(){
    var el = document.createElement("div");
    if( el.addBehavior ){
        return true;
    }
    return false;
};

_xinstore_db_ie.prototype.init = function( name, cfg, onReady ){
    this.name = name;
    
    var el = document.getElementById( this.xid );
    if( !el ){
        el = document.createElement("div");
        document.body.appendChild( el );
    }
    el.style.display = "none";
    el.setAttribute( "id", this.xid );
    el.addBehavior("#default#userData");
    this.store = el;

    if( typeof(onReady) == "function" ){
        onReady();
    }
};

_xinstore_db_ie.prototype._key = function( key ){
    return key.replace( ".", "_" ).split(' ').join('');
};

_xinstore_db_ie.prototype.get = function( key ){
    key = this._key( key );
    this.store.load( this.xid );
    var value = this.store.getAttribute( key );
    return value;
};
_xinstore_db_ie.prototype.set = function( key, value ){
    key = this._key( key );
    this.store.load( this.xid );
    this.store.setAttribute( key, value );
    this.store.save( this.xid );
};
_xinstore_db_ie.prototype.remove = function( key, value ){
    key = this._key( key );
    this.store.load( this.xid );
    this.store.removeAttribute( key );
    this.store.save( this.xid );
};
_xinstore_db_ie.prototype.clear = function(){
    key = this._key( key );
    this.store.load( this.xid );
    var attrs = this.store.attributes();
    var i;
    for( i=0; i<attrs.length; i++ ){
        var key = attrs[i].name;
        this.store.removeAttribute( key );
    }
    this.store.save( this.xid );
};

xinstore.db.ie = new _xinstore_db_ie();
xinstore.dbs.push( xinstore.db.ie );